#docker rmi -f bitnami/mysql:8.0.26
docker pull bitnami/mysql:8.0.26
rm -rf /cardone/docker/images/bitnami/mysql_8.0.26.tar
mkdir -p /cardone/docker/images/bitnami
docker save bitnami/mysql:8.0.26 > /cardone/docker/images/bitnami/mysql_8.0.26.tar
#docker load < /cardone/docker/images/bitnami/mysql_8.0.26.tar


# docker node update --label-rm cardone-mysql_mysql-master cardone-01-02
# docker node update --label-rm cardone-mysql_mysql-slave-1 cardone-01-03
# docker node update --label-rm cardone-mysql_mysql-slave-1 cardone-01-04

docker node update --label-add cardone-mysql_mysql-master=true cardone-01-02
docker node update --label-add cardone-mysql_mysql-slave-1=true cardone-01-03
docker node update --label-add cardone-mysql_mysql-slave-2=true cardone-01-04

docker stack rm cardone-mysql

docker stack deploy -c /cardone/middlewares/mysql/prod.yml cardone-mysql

for i in {1..10}  
do  
sleep $i

docker stack ps cardone-mysql

docker service ls
done

docker service logs cardone-mysql_mysql-master -f --tail 300

docker service logs cardone-mysql_mysql-slave-1 -f --tail 300
